# -*- coding: mbcs -*-
#
# Abaqus/CAE Release 2020 replay file
# Internal Version: 2019_09_14-01.49.31 163176
# Run by Administrator on Thu Jul  8 15:08:43 2021
#

# from driverUtils import executeOnCaeGraphicsStartup
# executeOnCaeGraphicsStartup()
#: Executing "onCaeGraphicsStartup()" in the site directory ...
from abaqus import *
from abaqusConstants import *
session.Viewport(name='Viewport: 1', origin=(0.0, 0.0), width=217.581253051758, 
    height=106.80339050293)
session.viewports['Viewport: 1'].makeCurrent()
session.viewports['Viewport: 1'].maximize()
from caeModules import *
from driverUtils import executeOnCaeStartup
executeOnCaeStartup()
session.viewports['Viewport: 1'].partDisplay.geometryOptions.setValues(
    referenceRepresentation=ON)
import os
os.chdir(r"E:\temp\XFEM_py")
import csv
o=session.openOdb(name='E:/temp/XFEM_py/Job-1.odb',readOnly=False)
session.viewports['Viewport: 1'].setValues(displayedObject=o)
session.viewports['Viewport: 1'].odbDisplay.setPrimaryVariable(
    variableLabel='S', outputPosition=INTEGRATION_POINT, refinement=(INVARIANT, 
    'Mises'), )
session.viewports['Viewport: 1'].odbDisplay.display.setValues(
    plotState=CONTOURS_ON_DEF)
frames=o.steps['Step-1'].frames
odbdis=session.viewports['Viewport: 1'].odbDisplay
S_max=[]
for ff in frames:
    frame_vp=odbdis.setFrame(frame=ff)
    S_max.append([odbdis.contourOptions.autoMaxValue,ff.frameValue])
CsvFilePath='E:/temp/XFEM_py/XFEM.csv'
csvFile=open(CsvFilePath,'wb')
writer=csv.writer(csvFile)
writer.writerow(['S_max','frameValue'])
lenth=len(S_max)
i=0
while i<lenth:
    writer.writerow([S_max[i][0],S_max[i][1]])
    i=i+1
csvFile.close()
